package org.book.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.*;
import org.book.bean.Borrow;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author dancun
 * @since 2021-03-05
 */
@Mapper
@Repository
public interface BorrowMapper extends BaseMapper<Borrow> {

    @Results(id = "baseMap" ,value = {
            @Result(property = "bookname",column = "name")
    })
    @Select("SELECT * FROM `borrow` join book on borrow.isbn=book.isbn ${ew.customSqlSegment}")
    public List<Borrow> listBorrow( @Param(Constants.WRAPPER) QueryWrapper wrapper);

}
